package com.lenovo.lcdm.type.util;

import java.util.function.Function;


public class CommonUtils {

    public static <I, O> O safeConvert(I input, Function<I, O> converter) {
       return safeConvert(input, converter, null);
    }

    public static <I, O> O safeConvert(I input, Function<I, O> converter, O defaultOutput) {
        if (ObjectUtil.isAnyEmpty(input)) {
            return defaultOutput;
        }

        return converter.apply(input);
    }
}
